package itsm.isperp.module.service.app;

import itsm.isperp.framework.quartz.domain.JobDefinition;
import itsm.isperp.framework.quartz.domain.JobState;
import itsm.isperp.framework.service.BaseService;
import itsm.isperp.module.entity.app.AppJob;
import itsm.isperp.module.repository.app.AppJobMapper;
import itsm.isperp.module.repository.app.AppJobParameterMapper;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * {@link JobDefinition}对象的基础服务.
 * <p>
 * 提供了大部分常用的功能,如调度,停止调度,查询,更新等.
 * </p>
 * 
 * 
 * @author lizx
 * @since 1.0
 */
@Service
public class AppQuartzJobService extends BaseService<AppJob> {

	public static final String companyId = "isperp";
	@Autowired
	protected AppJobSchedulerService appJobSchedulerService;

	@Autowired
	protected AppJobParameterMapper appJobParameterMapper;

	@Autowired
	protected AppJobMapper appJobMapper;

	@Override
	public AppJobMapper getRepository() {
		return this.appJobMapper;
	}

	public List<AppJob> loadJobs(JobState state) {
		return appJobMapper.findAllByStatus(state.toString());
	}
}
